import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入mock模拟数据
import '@/mock/mockServer'
// 引入swiper样式
import 'swiper/css/swiper.min.css'
// 引入全局组件TypeNav
import TypeNav from '@/components/TypeNav/TypeNav'
import Banner from '@/components/Banner/index'
import PageNation from '@/components/Pagenation/index'
// 引入统一接口所有的API
import * as API from '@/api'
// 按需引入element-ui组件
import { Button, MessageBox } from 'element-ui'
// 引入懒加载插件
import VueLazyload from 'vue-lazyload'
// 引入懒加载的图片
import logo from '@/assets/logo.png'
// 引入校验表单插件
import '@/plugins/vee-validate'
Vue.config.productionTip = false

// 注册全局组件
Vue.component('TypeNav', TypeNav)
Vue.component('Banner', Banner)
Vue.component('PageNation', PageNation)
// 全局注册
Vue.use(Button)
Vue.use(VueLazyload, {
  loading: logo,
})
// 挂载在Vue原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;


new Vue({
  // 注册路由器$router
  router,
  // 注册$store
  store,
  // 注册全局事件总线$bus
  beforeCreate() {
    Vue.prototype.$bus = this
    Vue.prototype.$API = API
  },
  render: h => h(App)
}).$mount('#app')
